Feature: Census Page - Get Agent Info

  # Author: Maria Chen
  # Execution&Update History
  # |Date          |Owner        |Update/Execution Remark        |Comments                          |
  # |4/7/2016    |Maria Chen   |First Draft                    |
  Background: 
    Given these Agents:
      | agentId | allianceId |
      | 647264  | Gro21010   |
      | 587336  | Lif25311   |

  @happy
  Scenario: Get Agent Info with vaild agent id and alliance id
    When I send a GET request to "user/agent-user/Gro21010/647264"
    Then the response status should be 200
    And the JSON response should be
      """
      {
      "firstName": "Fghcia",
      "lastName": "Lghcia",
      "email": "GHCIA0913111821@ehealthqa.com",
      "phoneAreaCode": "123",
      "phoneNumber": "456-0987",
      "phoneExt": null,
      "showPhoto": false
      }
      """

  @happy
  Scenario: Get Agent Info with vaild agent id and alliance id
    When I send a GET request to "user/agent-user/Lif25311/587336"
    Then the response status should be 200
    And the JSON response should be
      """
      {
      "firstName": "lwwaaZlzZOX)yg",
      "lastName": "lwwa#J#aYyaMbF",
      "email": "epqa.dean@2007.12.27.17.32.216.bt",
      "phoneAreaCode": "666",
      "phoneNumber": "777-8888",
      "phoneExt": "87654321",
      "showPhoto": false
      }
      """

  @sad
  Scenario: Agent id doesn't belong to the Carrier - System can't get the agent info
    When I send a GET request to "user/agent-user/Gro21010/1000001"
    Then the response status should be 200
    And the JSON response should be
      """
      {
      }
      """

  @sad
  Scenario: Alliance Id invalid - System can't get the agent info
    When I send a GET request to "user/agent-user/dd/1000001"
    Then the response status should be 200
    And the JSON response should be
      """
      {
      }
      """

  @sad
  Scenario: Alliance Id not provided in the url - System should return error message
    When I send a GET request to "user/agent-user//1000001"
    Then the response status should be 404
    And the error message should be "Resource doesn't exist"

  @sad
  Scenario: Agent Id not provided in the url - System should return error message
    When I send a GET request to "user/agent-user/"
    Then the response status should be 404
    And the error message should be "Resource doesn't exist"

  @sad
  Scenario: Agent not exist - System can't get the agent info
    When I send a GET request to "user/agent-user/Gro21010/1000001"
    Then the response status should be 200
    And the JSON response should be
      """
      {
      }
      """

  @sad
  Scenario: Agent Id invalid - System should return error message that agent id is invalid
    When I send a GET request to "user/agent-user/Gro21010/1000001dsd"
    Then the response status should be 400
    And the error type should be "PARAMETER_INVALID"
    And the error message should be "AgentId should be a number"

  @sad
  Scenario: Agent disabled - Sytem can't get the agent info
    When I send a GET request to "user/agent-user/Gro21010/5"
    Then the response status should be 200
    And the JSON response should be
      """
      {
      }
      """
